{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "408E7D614FB54B1D84A7B0A848C4C6F6",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "## 基本操作"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "EBBA275C49F24BAC8D5369F0674D34C6",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "1. 导入 Pandas 库并简写为 `pd`，并输出版本号"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false,
    "id": "DC71C3CB19FA450D9A22B0501097C7D9",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'1.4.4'"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "pd.__version__"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "4BDAA047C88D4A7284FBB11C93331AF5",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "2.从列表[0, 1, 2, 3, 4]创建 Series，并打印"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false,
    "id": "A3CE42AFF0F846F4831E88F2E4C5459B",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0    0\n",
       "1    1\n",
       "2    2\n",
       "3    3\n",
       "4    4\n",
       "dtype: int64"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "arr = [0, 1, 2, 3, 4]\n",
    "df = pd.Series(arr) # 如果不指定索引，则默认从 0 开始\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "042776A6C0144F8785E71383B58BEBAC",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "3.从字典{'a':1,'b':2,'c':3,'d':4,'e':5}创建 Series，并打印"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false,
    "id": "F910769AB5F64648A25447A3785E82BF",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "a    1\n",
       "b    2\n",
       "c    3\n",
       "d    4\n",
       "e    5\n",
       "dtype: int64"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "d = {'a':1,'b':2,'c':3,'d':4,'e':5}\n",
    "df = pd.Series(d)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "36D50B633631470282A0E6323A76D2ED",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "4.从 NumPy 数组创建 DataFrame,行名称为日期从今天开始到未来5天，提示：pd.date_range('today',periods=6)；列名为'A','B','C','D'；数值内容为随机数。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false,
    "id": "43B11711239D40A6843D5CD1D3880030",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>A</th>\n",
       "      <th>B</th>\n",
       "      <th>C</th>\n",
       "      <th>D</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2024-10-29 14:31:18.842845</th>\n",
       "      <td>0.338507</td>\n",
       "      <td>-0.662537</td>\n",
       "      <td>-1.600924</td>\n",
       "      <td>0.455639</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-10-30 14:31:18.842845</th>\n",
       "      <td>-0.161491</td>\n",
       "      <td>-0.568001</td>\n",
       "      <td>1.161695</td>\n",
       "      <td>0.929498</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-10-31 14:31:18.842845</th>\n",
       "      <td>-0.248715</td>\n",
       "      <td>1.314323</td>\n",
       "      <td>-0.792638</td>\n",
       "      <td>0.318517</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-11-01 14:31:18.842845</th>\n",
       "      <td>-0.743936</td>\n",
       "      <td>3.011478</td>\n",
       "      <td>-0.641735</td>\n",
       "      <td>-0.018809</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-11-02 14:31:18.842845</th>\n",
       "      <td>-1.151091</td>\n",
       "      <td>0.381308</td>\n",
       "      <td>0.676622</td>\n",
       "      <td>1.034199</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2024-11-03 14:31:18.842845</th>\n",
       "      <td>-0.879936</td>\n",
       "      <td>-1.749738</td>\n",
       "      <td>1.176395</td>\n",
       "      <td>0.604599</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                   A         B         C         D\n",
       "2024-10-29 14:31:18.842845  0.338507 -0.662537 -1.600924  0.455639\n",
       "2024-10-30 14:31:18.842845 -0.161491 -0.568001  1.161695  0.929498\n",
       "2024-10-31 14:31:18.842845 -0.248715  1.314323 -0.792638  0.318517\n",
       "2024-11-01 14:31:18.842845 -0.743936  3.011478 -0.641735 -0.018809\n",
       "2024-11-02 14:31:18.842845 -1.151091  0.381308  0.676622  1.034199\n",
       "2024-11-03 14:31:18.842845 -0.879936 -1.749738  1.176395  0.604599"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "dates = pd.date_range('today',periods=6) # 定义时间序列作为 index\n",
    "num_arr = np.random.randn(6,4) # 传入 numpy 随机数组\n",
    "columns = ['A','B','C','D'] # 将列表作为列名\n",
    "df1 = pd.DataFrame(num_arr, index = dates, columns = columns)\n",
    "df1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "D7D785E5CA3C497C8C4765D984432CD8",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "5.创建一个test.csv文件，使用gbk编码，文件的内容为：\n",
    "id,name,age,gender\n",
    "1,张三,20,男\n",
    "2,李四,21,男\n",
    "3,王五,22,女\n",
    "\n",
    "从CSV中创建 DataFrame，分隔符为`;`，编码格式为`gbk`，文件名为`test.csv`，并打印结果。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "collapsed": false,
    "id": "4F16DA0868BF484A85F9E690ADD9E4AD",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>id</th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>张三</td>\n",
       "      <td>20</td>\n",
       "      <td>男</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>李四</td>\n",
       "      <td>21</td>\n",
       "      <td>男</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>王五</td>\n",
       "      <td>22</td>\n",
       "      <td>女</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   id name  age gender\n",
       "0   1   张三   20      男\n",
       "1   2   李四   21      男\n",
       "2   3   王五   22      女"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.read_csv('test.csv', encoding='gbk', sep=',')\n",
    "df"
   ]
  },
  {
   "attachments": {
    "image.png": {
     "image/png": "iVBORw0KGgoAAAANSUhEUgAAAPkAAAE1CAYAAAAlEkbrAAAgAElEQVR4Ae1dPWtsyRX0P9lwQ/8BZco2UKTIkdlQgSIvvMAoENjgwAiWBYHYXcTCPgwSBikxBimRAinY/zSmZl2i3pm+H3M/u3sqGPre/qxzTlWfvvfpzfzhq6++2vhjH5gD9XLgDw5uvcF1bB1bcMAi90nGJ7nKOWCRVx5gZ3Nn8x2R//GPf9z4Yx+YA+VzgBu8Re5NzZt6pRywyCsNrDNw+Rl4qhha5Ba5M3jlHLDIKw/wVNnA85R7MrDILXJn8so5YJFXHmBn4HIz8F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yTijxFqpwIw6zHo+vnz5+/OK7H9vf3952jPAjG8cySa5KuzecQRTzK41EKjygYl1Ns+mKpVeTcfGEf+RV5pdzb50RzMCKngNVxcCiFzHbUkXAQCZ59KQiMVdGgfR9nc94pSpJB8cV5LfL9Ml7035L3FDBihnVRkpu4R7vGGpzEPfu3YT0YkacymGbBVDuFD0fqtToUYtONQ9uWuGawUxiAWzcl4EnZuQTOqdZY299T2RHnQfw0wSjf9FrHxTHaptcHI/IU4VXkqXY4iqTSvupAtmvd0tdNwk3ZhL6Pj4+Nb+OXxr7vejn4e1/MffpHwaqwm7iXim9qrYMReUoIqMORB2WqHQ4DqeBMZkxc05EMRCqLss8SZRP2VH0k0xL4plzjEEVOnin34FPcwx9d/j0YkVOkKkg4iM89dKQ6DU7U5yC06fEX7Ws8k9/e3n68J4i4IWxuXAg+MNMm+iCSpYskObXDFo1hTtjGYImbL+PKWKFdubhPLA9G5AgAHcO3l99//33r23V1KsbT8RxPAS1NOqxHDCgpYmCMIo+YSZoxhFxz7KGKHD6Pce8by0lFnjoerkmIudemgPo6e248nr+ct+lLxmpSkWOn0ayypCFrrAV7Y7ZfA4fXtLjbODCJyHmMqJ3wtJNH5drtbSOO28rZWCYRuQNeTsAdq8OLlUVe+X8ztKgPT9Qx5ha5Rd7576yRNL4va+OwyC1yi7xyDljklQfYWbesrDtHvBpFzgaX5f/QnWPoGIIDOz+TZGKYGOZAXRywyCv/RUsLti7BDomnRW6R+6eLK+eARV55gIfs/B5TV/a3yC1yZ/LKOWCRVx5gZ+W6svKQeFrkFrkzeeUc+B+qqWgfaQ+SrAAAAABJRU5ErkJggg=="
    }
   },
   "cell_type": "markdown",
   "metadata": {
    "id": "2E270529EBA14E9583C308DFBED813F0",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "6.从字典对象`data`创建DataFrame，要求创建后的结果为：\n",
    "\n",
    "![image.png](attachment:image.png)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "collapsed": false,
    "id": "4C7745E1545D40A4B1DF01B9FACAB322",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "      <th>visits</th>\n",
       "      <th>priority</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>cat</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>snake</td>\n",
       "      <td>0.5</td>\n",
       "      <td>2</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>dog</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>e</th>\n",
       "      <td>dog</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>f</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.0</td>\n",
       "      <td>3</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>g</th>\n",
       "      <td>snake</td>\n",
       "      <td>4.5</td>\n",
       "      <td>1</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>h</th>\n",
       "      <td>cat</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>i</th>\n",
       "      <td>dog</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>j</th>\n",
       "      <td>dog</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  animal  age  visits priority\n",
       "a    cat  2.5       1      yes\n",
       "b    cat  3.0       3      yes\n",
       "c  snake  0.5       2       no\n",
       "d    dog  NaN       3      yes\n",
       "e    dog  5.0       2       no\n",
       "f    cat  2.0       3       no\n",
       "g  snake  4.5       1       no\n",
       "h    cat  NaN       1      yes\n",
       "i    dog  7.0       2       no\n",
       "j    dog  3.0       1       no"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "data = {'animal': ['cat', 'cat', 'snake', 'dog', 'dog', 'cat', 'snake', 'cat', 'dog', 'dog'],\n",
    "        'age': [2.5, 3, 0.5, np.nan, 5, 2, 4.5, np.nan, 7, 3],\n",
    "        'visits': [1, 3, 2, 3, 2, 3, 1, 1, 2, 1],\n",
    "        'priority': ['yes', 'yes', 'no', 'yes', 'no', 'no', 'no', 'yes', 'no', 'no']}\n",
    "\n",
    "labels = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']\n",
    "\n",
    "df = pd.DataFrame(data, index=labels)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "D1973CA623394A5F8C3F356AD4D5F98B",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "7.显示DataFrame的基础信息，包括行的数量；列名；每一列值的数量、类型；\n",
    "将数据存储为csv文件，提示：df.to_csv('animal.csv', encoding='utf-8', sep=',')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "collapsed": false,
    "id": "704A3A9393CA4C3BBFC4382B2AC013ED",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Index: 10 entries, a to j\n",
      "Data columns (total 4 columns):\n",
      " #   Column    Non-Null Count  Dtype  \n",
      "---  ------    --------------  -----  \n",
      " 0   animal    10 non-null     object \n",
      " 1   age       8 non-null      float64\n",
      " 2   visits    10 non-null     int64  \n",
      " 3   priority  10 non-null     object \n",
      "dtypes: float64(1), int64(1), object(2)\n",
      "memory usage: 400.0+ bytes\n"
     ]
    }
   ],
   "source": [
    "df.info()\n",
    "# 方法二\n",
    "# df.describe()\n",
    "\n",
    "df.to_csv('animal.csv', encoding='utf-8', sep=',')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "ABD97C9AF1AF4F808D803BC99DDB42A0",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "8.展示`df`的前3行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false,
    "id": "174EEA3F312E492B8194DB974137AC9F",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "      <th>visits</th>\n",
       "      <th>priority</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>cat</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>snake</td>\n",
       "      <td>0.5</td>\n",
       "      <td>2</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  animal  age  visits priority\n",
       "a    cat  2.5       1      yes\n",
       "b    cat  3.0       3      yes\n",
       "c  snake  0.5       2       no"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.iloc[:3]\n",
    "# 方法二\n",
    "#df.head(3)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "C746F0B208A544F8869B7BEA45C0D604",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "9.取出`df`的`animal`和`age`列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false,
    "id": "5C0327B056874AB3A61AA67A0700D026",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>cat</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>snake</td>\n",
       "      <td>0.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>dog</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>e</th>\n",
       "      <td>dog</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>f</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>g</th>\n",
       "      <td>snake</td>\n",
       "      <td>4.5</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>h</th>\n",
       "      <td>cat</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>i</th>\n",
       "      <td>dog</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>j</th>\n",
       "      <td>dog</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  animal  age\n",
       "a    cat  2.5\n",
       "b    cat  3.0\n",
       "c  snake  0.5\n",
       "d    dog  NaN\n",
       "e    dog  5.0\n",
       "f    cat  2.0\n",
       "g  snake  4.5\n",
       "h    cat  NaN\n",
       "i    dog  7.0\n",
       "j    dog  3.0"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.loc[:, ['animal', 'age']]\n",
    "# 方法二\n",
    "# df[['animal', 'age']]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "A7C3AECC6B4C418683E826866F2A00BF",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "10.取出索引为`[3, 4, 8]`行的`animal`和`age`列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false,
    "id": "28628128E7AD42A28F2235E36E81DC82",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>dog</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>e</th>\n",
       "      <td>dog</td>\n",
       "      <td>5.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>i</th>\n",
       "      <td>dog</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  animal  age\n",
       "d    dog  NaN\n",
       "e    dog  5.0\n",
       "i    dog  7.0"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.loc[df.index[[3, 4, 8]], ['animal', 'age']]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "0DC73A3BAEE1471488F497ADAAECE9A4",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "11.取出`age`值大于3的行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false,
    "id": "5F6C4EBC5CAB46868AB9B6752AFE51B1",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "      <th>visits</th>\n",
       "      <th>priority</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>e</th>\n",
       "      <td>dog</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>g</th>\n",
       "      <td>snake</td>\n",
       "      <td>4.5</td>\n",
       "      <td>1</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>i</th>\n",
       "      <td>dog</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  animal  age  visits priority\n",
       "e    dog  5.0       2       no\n",
       "g  snake  4.5       1       no\n",
       "i    dog  7.0       2       no"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[df['age'] > 3]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "B58686B7272F471A8C3CA3BBABF8CFDB",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "12.取出`age`值缺失的行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false,
    "id": "88C1B731BFB646EAA76E284E472AA440",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "      <th>visits</th>\n",
       "      <th>priority</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>dog</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>h</th>\n",
       "      <td>cat</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  animal  age  visits priority\n",
       "d    dog  NaN       3      yes\n",
       "h    cat  NaN       1      yes"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[df['age'].isnull()]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "4F4812626E7F491CAF83EB425A452595",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "13.取出`age`在2,4间的行（不含）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "collapsed": false,
    "id": "C8CEA4CE37984E0783711C683257CCBA",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "      <th>visits</th>\n",
       "      <th>priority</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>cat</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>j</th>\n",
       "      <td>dog</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  animal  age  visits priority\n",
       "a    cat  2.5       1      yes\n",
       "b    cat  3.0       3      yes\n",
       "j    dog  3.0       1       no"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df[(df['age']>2) & (df['age']<4)]\n",
    "# 方法二\n",
    "#df[df['age'].between(2, 4)]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "EC4A3E47A9F94C94BC1EA9BD25CB2AC3",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "14.`f`行的`age`改为1.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": false,
    "id": "749484D2F77E4F6A8C03820E772432DE",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [],
   "source": [
    "df.loc['f', 'age'] = 1.5"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "4785E429ACA04385835A814AFF4F59A0",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "15.计算`visits`的总和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "collapsed": false,
    "id": "37AD6C06B30947428FF7DDD1F7C39838",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "19"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['visits'].sum()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "512DCEC2028848C89E03A41E555A167E",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "16.计算每个不同种类`animal`的`age`的平均数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "collapsed": false,
    "id": "31E587F50D69457ABC853375B8CBE1AF",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "animal\n",
       "cat      2.333333\n",
       "dog      5.000000\n",
       "snake    2.500000\n",
       "Name: age, dtype: float64"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.groupby('animal')['age'].mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "F1C3C328E8624CE5B6B93BAFE03652D8",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "17.计算`df`中每个种类`animal`的数量"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "collapsed": false,
    "id": "E085A0DFC1F94C749D3234D0F86ABCBA",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "cat      4\n",
       "dog      4\n",
       "snake    2\n",
       "Name: animal, dtype: int64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['animal'].value_counts()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "C242DEBB812846F592335C1CEDD7DBE7",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "18.先按`age`降序排列，后按`visits`升序排列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "collapsed": false,
    "id": "1743410F4F2E4AA48DA1BAD60AAEFFB6",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "      <th>visits</th>\n",
       "      <th>priority</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>i</th>\n",
       "      <td>dog</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>e</th>\n",
       "      <td>dog</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>g</th>\n",
       "      <td>snake</td>\n",
       "      <td>4.5</td>\n",
       "      <td>1</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>j</th>\n",
       "      <td>dog</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>cat</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>f</th>\n",
       "      <td>cat</td>\n",
       "      <td>1.5</td>\n",
       "      <td>3</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>snake</td>\n",
       "      <td>0.5</td>\n",
       "      <td>2</td>\n",
       "      <td>no</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>h</th>\n",
       "      <td>cat</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>dog</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3</td>\n",
       "      <td>yes</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  animal  age  visits priority\n",
       "i    dog  7.0       2       no\n",
       "e    dog  5.0       2       no\n",
       "g  snake  4.5       1       no\n",
       "j    dog  3.0       1       no\n",
       "b    cat  3.0       3      yes\n",
       "a    cat  2.5       1      yes\n",
       "f    cat  1.5       3       no\n",
       "c  snake  0.5       2       no\n",
       "h    cat  NaN       1      yes\n",
       "d    dog  NaN       3      yes"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.sort_values(by=['age', 'visits'], ascending=[False, True])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "8DAC0489BCF345D18722936760521D10",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "19.将`priority`列中的`yes, no`替换为布尔值`True, False`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": false,
    "id": "7AC076FE991A4A7C86C270465AEEC2A5",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "      <th>visits</th>\n",
       "      <th>priority</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>cat</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>snake</td>\n",
       "      <td>0.5</td>\n",
       "      <td>2</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>dog</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>e</th>\n",
       "      <td>dog</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>f</th>\n",
       "      <td>cat</td>\n",
       "      <td>1.5</td>\n",
       "      <td>3</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>g</th>\n",
       "      <td>snake</td>\n",
       "      <td>4.5</td>\n",
       "      <td>1</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>h</th>\n",
       "      <td>cat</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>i</th>\n",
       "      <td>dog</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>j</th>\n",
       "      <td>dog</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  animal  age  visits  priority\n",
       "a    cat  2.5       1      True\n",
       "b    cat  3.0       3      True\n",
       "c  snake  0.5       2     False\n",
       "d    dog  NaN       3      True\n",
       "e    dog  5.0       2     False\n",
       "f    cat  1.5       3     False\n",
       "g  snake  4.5       1     False\n",
       "h    cat  NaN       1      True\n",
       "i    dog  7.0       2     False\n",
       "j    dog  3.0       1     False"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['priority'] = df['priority'].map({'yes': True, 'no': False})\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "011AD6B2DB3F4FF68B6BF78C17606F13",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "20.将`animal`列中的`snake`替换为`python`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "collapsed": false,
    "id": "BB3E112D297445688FF0BBD9A7EE7E27",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "      <th>visits</th>\n",
       "      <th>priority</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>cat</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>python</td>\n",
       "      <td>0.5</td>\n",
       "      <td>2</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>dog</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>e</th>\n",
       "      <td>dog</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>f</th>\n",
       "      <td>cat</td>\n",
       "      <td>1.5</td>\n",
       "      <td>3</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>g</th>\n",
       "      <td>python</td>\n",
       "      <td>4.5</td>\n",
       "      <td>1</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>h</th>\n",
       "      <td>cat</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>True</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>i</th>\n",
       "      <td>dog</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>j</th>\n",
       "      <td>dog</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1</td>\n",
       "      <td>False</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   animal  age  visits  priority\n",
       "a     cat  2.5       1      True\n",
       "b     cat  3.0       3      True\n",
       "c  python  0.5       2     False\n",
       "d     dog  NaN       3      True\n",
       "e     dog  5.0       2     False\n",
       "f     cat  1.5       3     False\n",
       "g  python  4.5       1     False\n",
       "h     cat  NaN       1      True\n",
       "i     dog  7.0       2     False\n",
       "j     dog  3.0       1     False"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['animal'] = df['animal'].replace('snake', 'python')\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "3BA3F97990E346A5836836864EB4FFB8",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "21.对每种`animal`的每种不同数量`visits`，计算平均`age`，即，返回一个表格，行是`aniaml`种类，列是`visits`数量，表格值是行动物种类列访客数量的平均年龄"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "collapsed": false,
    "id": "AF5A8AAAB4884450B89A9544B40DD4ED",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "animal       object\n",
       "age         float64\n",
       "visits        int64\n",
       "priority       bool\n",
       "dtype: object"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.dtypes"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": false,
    "id": "83C7501AF44F47AA8E5258652FDF9988",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [],
   "source": [
    "df.age=df.age.astype(float)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "collapsed": false,
    "id": "E784D19B88B3426498F0B41FCC4290C6",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>visits</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>animal</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>cat</th>\n",
       "      <td>2.5</td>\n",
       "      <td>NaN</td>\n",
       "      <td>2.25</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>dog</th>\n",
       "      <td>3.0</td>\n",
       "      <td>6.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>python</th>\n",
       "      <td>4.5</td>\n",
       "      <td>0.5</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "visits    1    2     3\n",
       "animal                \n",
       "cat     2.5  NaN  2.25\n",
       "dog     3.0  6.0   NaN\n",
       "python  4.5  0.5   NaN"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.pivot_table(index='animal', columns='visits', values='age', aggfunc='mean')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "54EC83F0A5AC41D88DEB3D986A9F608C",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "22.在`df`中插入新行`k`，然后删除该行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "collapsed": false,
    "id": "8CCB1591219B4CA983EEF993924C726C",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>animal</th>\n",
       "      <th>age</th>\n",
       "      <th>visits</th>\n",
       "      <th>priority</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>a</th>\n",
       "      <td>cat</td>\n",
       "      <td>2.5</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>b</th>\n",
       "      <td>cat</td>\n",
       "      <td>3.0</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>c</th>\n",
       "      <td>python</td>\n",
       "      <td>0.5</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>d</th>\n",
       "      <td>dog</td>\n",
       "      <td>NaN</td>\n",
       "      <td>3</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>e</th>\n",
       "      <td>dog</td>\n",
       "      <td>5.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>f</th>\n",
       "      <td>cat</td>\n",
       "      <td>1.5</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>g</th>\n",
       "      <td>python</td>\n",
       "      <td>4.5</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>h</th>\n",
       "      <td>cat</td>\n",
       "      <td>NaN</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>i</th>\n",
       "      <td>dog</td>\n",
       "      <td>7.0</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>j</th>\n",
       "      <td>dog</td>\n",
       "      <td>3.0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   animal  age visits  priority\n",
       "a     cat  2.5      1         1\n",
       "b     cat  3.0      3         1\n",
       "c  python  0.5      2         0\n",
       "d     dog  NaN      3         1\n",
       "e     dog  5.0      2         0\n",
       "f     cat  1.5      3         0\n",
       "g  python  4.5      1         0\n",
       "h     cat  NaN      1         1\n",
       "i     dog  7.0      2         0\n",
       "j     dog  3.0      1         0"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#插入\n",
    "df.loc['k'] = [5.5, 'dog', 'no', 2]\n",
    "# 删除\n",
    "df = df.drop('k')\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "E4BF6769090045D9BBAA73B83A6D0304",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "## 进阶操作"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "EC5E11D6D5E745CA888128DC64E933B9",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "23.有一列整数列`A`的DatraFrame，删除数值重复的行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "collapsed": false,
    "id": "E64946439A524AF8817063EF7C3B9AC3",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    A\n",
      "0   1\n",
      "1   2\n",
      "2   2\n",
      "3   3\n",
      "4   4\n",
      "5   5\n",
      "6   5\n",
      "7   5\n",
      "8   6\n",
      "9   7\n",
      "10  7\n",
      "   A\n",
      "0  1\n",
      "1  2\n",
      "3  3\n",
      "4  4\n",
      "5  5\n",
      "8  6\n",
      "9  7\n"
     ]
    }
   ],
   "source": [
    "df = pd.DataFrame({'A': [1, 2, 2, 3, 4, 5, 5, 5, 6, 7, 7]})\n",
    "print(df)\n",
    "df1 = df.loc[df['A'].shift() != df['A']]\n",
    "# 方法二\n",
    "# df1 = df.drop_duplicates(subset='A')\n",
    "print(df1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "52EF04D119B045D29071C0635CBF854D",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "24.一个全数值DatraFrame，每个数字减去该行的平均数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "collapsed": false,
    "id": "50FEE2500BC64CBA8EB44425860DAA9C",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "          0         1         2\n",
      "0  0.038226  0.926957  0.042548\n",
      "1  0.705815  0.546193  0.400632\n",
      "2  0.960504  0.565964  0.505897\n",
      "3  0.327432  0.449940  0.352056\n",
      "4  0.599079  0.747863  0.365700\n",
      "          0         1         2\n",
      "0 -0.297684  0.591047 -0.293363\n",
      "1  0.154935 -0.004686 -0.150248\n",
      "2  0.283049 -0.111491 -0.171558\n",
      "3 -0.049044  0.073464 -0.024420\n",
      "4  0.028199  0.176982 -0.205181\n"
     ]
    }
   ],
   "source": [
    "df = pd.DataFrame(np.random.random(size=(5, 3)))\n",
    "print(df)\n",
    "df1 = df.sub(df.mean(axis=1), axis=0)\n",
    "print(df1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "935456754362412684F8A7DB2BB264DE",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "25.一个有5列的DataFrame，求哪一列的和最小"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "collapsed": false,
    "id": "81B9F18E6DD94167B6D304E54DBBE7BD",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "          a         b         c         d         e\n",
      "0  0.270686  0.460923  0.189626  0.472618  0.502531\n",
      "1  0.009992  0.608497  0.572003  0.075397  0.229903\n",
      "2  0.837243  0.231713  0.759028  0.919897  0.164905\n",
      "3  0.798490  0.790687  0.362319  0.738086  0.884509\n",
      "4  0.444362  0.411971  0.034676  0.611085  0.701763\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "'c'"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(np.random.random(size=(5, 5)), columns=list('abcde'))\n",
    "print(df)\n",
    "df.sum().idxmin()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "7418298827EF4DE18D88D79ABEE3389C",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "26.给定DataFrame，求`A`列每个值的前3大的`B`的和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "collapsed": false,
    "id": "E3316FCA37B04ECF94808EACA6702994",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    A    B\n",
      "0   a   12\n",
      "1   a  345\n",
      "2   a    3\n",
      "3   b    1\n",
      "4   b   45\n",
      "5   c   14\n",
      "6   a    4\n",
      "7   a   52\n",
      "8   b   54\n",
      "9   c   23\n",
      "10  c  235\n",
      "11  c   21\n",
      "12  b   57\n",
      "13  b    3\n",
      "14  c   87\n",
      "910\n"
     ]
    }
   ],
   "source": [
    "df = pd.DataFrame({'A': list('aaabbcaabcccbbc'), \n",
    "                   'B': [12,345,3,1,45,14,4,52,54,23,235,21,57,3,87]})\n",
    "print(df)\n",
    "df1 = df.groupby('A')['B'].nlargest(3).sum()\n",
    "print(df1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "42417D37787F4199A3A7B4E35F691433",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "27.给定DataFrame，有列`A, B`，`A`的值在1-100（含），对`A`列每10步长，求对应的`B`的和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "collapsed": false,
    "id": "226877047B334FC7A3F075152E048FF6",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "    A   B\n",
      "0   1   1\n",
      "1   2   2\n",
      "2  11  11\n",
      "3  11  11\n",
      "4  33  33\n",
      "5  34  34\n",
      "6  35  35\n",
      "7  40  40\n",
      "8  79  79\n",
      "9  99  99\n",
      "A\n",
      "(0, 10]        3\n",
      "(10, 20]      22\n",
      "(20, 30]       0\n",
      "(30, 40]     142\n",
      "(40, 50]       0\n",
      "(50, 60]       0\n",
      "(60, 70]       0\n",
      "(70, 80]      79\n",
      "(80, 90]       0\n",
      "(90, 100]     99\n",
      "Name: B, dtype: int64\n"
     ]
    }
   ],
   "source": [
    "df = pd.DataFrame({'A': [1,2,11,11,33,34,35,40,79,99], \n",
    "                   'B': [1,2,11,11,33,34,35,40,79,99]})\n",
    "print(df)\n",
    "df1 = df.groupby(pd.cut(df['A'], np.arange(0, 101, 10)))['B'].sum()\n",
    "print(df1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "4A41563F4E83421E99DC691CDCBF1B5F",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "28.给定DataFrame，计算每个元素至左边最近的`0`（或者至开头）的距离，生成新列`y`"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {
    "collapsed": false,
    "id": "83E7FDD067C546ED8FC7260C12CB49D4",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   X  Y\n",
      "0  7  1\n",
      "1  2  2\n",
      "2  0  0\n",
      "3  3  1\n",
      "4  4  2\n",
      "5  2  3\n",
      "6  5  4\n",
      "7  0  0\n",
      "8  3  1\n",
      "9  4  2\n"
     ]
    }
   ],
   "source": [
    "df = pd.DataFrame({'X': [7, 2, 0, 3, 4, 2, 5, 0, 3, 4]})\n",
    "\n",
    "izero = np.r_[-1, (df['X'] == 0).to_numpy().nonzero()[0]] # 标记0的位置\n",
    "idx = np.arange(len(df))\n",
    "df['Y'] = idx - izero[np.searchsorted(izero - 1, idx) - 1]\n",
    "print(df)\n",
    "\n",
    "# 方法二\n",
    "# x = (df['X'] != 0).cumsum()\n",
    "# y = x != x.shift()\n",
    "# df['Y'] = y.groupby((y != y.shift()).cumsum()).cumsum()\n",
    "\n",
    "# 方法三\n",
    "# df['Y'] = df.groupby((df['X'] == 0).cumsum()).cumcount()\n",
    "#first_zero_idx = (df['X'] == 0).idxmax()\n",
    "# df['Y'].iloc[0:first_zero_idx] += 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "C6EFAC00D81F4F629784CC2C59AAC6AB",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "29.一个全数值的DataFrame，返回最大3值的坐标"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {
    "collapsed": false,
    "id": "5C3C6B1686744DAD89695A3071E6F68B",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "          0         1         2\n",
      "0  0.958610  0.333694  0.884176\n",
      "1  0.991060  0.295749  0.637849\n",
      "2  0.646157  0.245455  0.082239\n",
      "3  0.524750  0.458012  0.857868\n",
      "4  0.754407  0.529949  0.078285\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "[(2, 0), (0, 0), (0, 1)]"
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame(np.random.random(size=(5, 3)))\n",
    "print(df)\n",
    "df.unstack().sort_values()[-3:].index.tolist()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "175D476BB4A24A74A99286D21B6BA1A2",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "30.给定DataFrame，将负值代替为同组的平均值"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "collapsed": false,
    "id": "553E4F00BFB44D968D1D87C4479B90D1",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   grps  vals\n",
      "0     a   -12\n",
      "1     a   345\n",
      "2     a     3\n",
      "3     b     1\n",
      "4     b    45\n",
      "5     c    14\n",
      "6     a     4\n",
      "7     a   -52\n",
      "8     b    54\n",
      "9     c    23\n",
      "10    c  -235\n",
      "11    c    21\n",
      "12    b    57\n",
      "13    b     3\n",
      "14    c    87\n",
      "   grps        vals\n",
      "0     a  117.333333\n",
      "1     a  345.000000\n",
      "2     a    3.000000\n",
      "3     b    1.000000\n",
      "4     b   45.000000\n",
      "5     c   14.000000\n",
      "6     a    4.000000\n",
      "7     a  117.333333\n",
      "8     b   54.000000\n",
      "9     c   23.000000\n",
      "10    c   36.250000\n",
      "11    c   21.000000\n",
      "12    b   57.000000\n",
      "13    b    3.000000\n",
      "14    c   87.000000\n"
     ]
    }
   ],
   "source": [
    "df = pd.DataFrame({'grps': list('aaabbcaabcccbbc'), \n",
    "                   'vals': [-12,345,3,1,45,14,4,-52,54,23,-235,21,57,3,87]})\n",
    "print(df)\n",
    "\n",
    "def replace(group):\n",
    "    mask = group<0\n",
    "    group[mask] = group[~mask].mean()\n",
    "    return group\n",
    "\n",
    "df['vals'] = df.groupby(['grps'])['vals'].transform(replace)\n",
    "print(df)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "531D55E9C6104DD68D133D310A9C6ADF",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "31.计算3位滑动窗口的平均值，忽略NAN"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": false,
    "id": "FB5B855534524B3185737D4B9840F377",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "   group  value\n",
      "0      a    1.0\n",
      "1      a    2.0\n",
      "2      b    3.0\n",
      "3      b    NaN\n",
      "4      a    2.0\n",
      "5      b    3.0\n",
      "6      b    NaN\n",
      "7      b    1.0\n",
      "8      a    7.0\n",
      "9      b    3.0\n",
      "10     a    NaN\n",
      "11     b    8.0\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "0     1.000000\n",
       "1     1.500000\n",
       "2     3.000000\n",
       "3     3.000000\n",
       "4     1.666667\n",
       "5     3.000000\n",
       "6     3.000000\n",
       "7     2.000000\n",
       "8     3.666667\n",
       "9     2.000000\n",
       "10    4.500000\n",
       "11    4.000000\n",
       "Name: value, dtype: float64"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame({'group': list('aabbabbbabab'),\n",
    "                    'value': [1, 2, 3, np.nan, 2, 3, np.nan, 1, 7, 3, np.nan, 8]})\n",
    "print(df)\n",
    "\n",
    "g1 = df.groupby(['group'])['value']\n",
    "g2 = df.fillna(0).groupby(['group'])['value'] \n",
    "\n",
    "s = g2.rolling(3, min_periods=1).sum() / g1.rolling(3, min_periods=1).count()\n",
    "\n",
    "s.reset_index(level=0, drop=True).sort_index() "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "0F3BEA0769BA46EE9663284836B66CBC",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "## Series 和 Datetime索引"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "C2D533ADDA924DCA8D6F0738301A925C",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "32.创建Series `s`，将2015所有工作日作为随机值的索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": false,
    "id": "D0C59B606E07405280B76B7BAA0D4DDA",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2015-01-01    0.034942\n",
       "2015-01-02    0.227404\n",
       "2015-01-05    0.081117\n",
       "2015-01-06    0.189444\n",
       "2015-01-07    0.734111\n",
       "2015-01-08    0.579403\n",
       "2015-01-09    0.914951\n",
       "2015-01-12    0.719770\n",
       "2015-01-13    0.848254\n",
       "2015-01-14    0.921822\n",
       "Freq: B, dtype: float64"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dti = pd.date_range(start='2015-01-01', end='2015-12-31', freq='B') \n",
    "s = pd.Series(np.random.rand(len(dti)), index=dti)\n",
    "\n",
    "s.head(10)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "5EE211F6B1384974BB98801E9D7F4FE7",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "33.所有礼拜三的值求和"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": false,
    "id": "2608EBB1A445402E823F8DB819B99022",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "21.847161995272927"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s[s.index.weekday == 2].sum() "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "358A1965800B4B4D8A018A4C70B70FB5",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "34.求每个自然月的平均数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": false,
    "id": "DE356545760A481E8E164FF508569B1F",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2015-01-31    0.506753\n",
       "2015-02-28    0.508177\n",
       "2015-03-31    0.607136\n",
       "2015-04-30    0.532224\n",
       "2015-05-31    0.484467\n",
       "2015-06-30    0.437450\n",
       "2015-07-31    0.437829\n",
       "2015-08-31    0.446865\n",
       "2015-09-30    0.573348\n",
       "2015-10-31    0.408742\n",
       "2015-11-30    0.453466\n",
       "2015-12-31    0.490939\n",
       "Freq: M, dtype: float64"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.resample('M').mean()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "5FDC751CEE534FDE9854536036EB49F5",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "35.每连续4个月为一组，求最大值所在的日期"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": false,
    "id": "93F635653DD14D29B7166D896B7F02E9",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2015-01-31   2015-01-14\n",
       "2015-05-31   2015-04-01\n",
       "2015-09-30   2015-06-18\n",
       "2016-01-31   2015-10-23\n",
       "Freq: 4M, dtype: datetime64[ns]"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.groupby(pd.Grouper(freq='4M')).idxmax()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "521B75EA73834A02AD0C21929A503AB3",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "36.创建2015-2016每月第三个星期四的序列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": false,
    "id": "06CC1162D5BC4D348F579609DDA184DC",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "DatetimeIndex(['2015-01-15', '2015-02-19', '2015-03-19', '2015-04-16',\n",
       "               '2015-05-21', '2015-06-18', '2015-07-16', '2015-08-20',\n",
       "               '2015-09-17', '2015-10-15', '2015-11-19', '2015-12-17',\n",
       "               '2016-01-21', '2016-02-18', '2016-03-17', '2016-04-21',\n",
       "               '2016-05-19', '2016-06-16', '2016-07-21', '2016-08-18',\n",
       "               '2016-09-15', '2016-10-20', '2016-11-17', '2016-12-15'],\n",
       "              dtype='datetime64[ns]', freq='WOM-3THU')"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.date_range('2015-01-01', '2016-12-31', freq='WOM-3THU')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "0A6698CC0BE34C849855C4A507E38C17",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "## 数据清洗"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": false,
    "id": "781F1B8BEA8F43D59E5E6F31923398F9",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>From_To</th>\n",
       "      <th>FlightNumber</th>\n",
       "      <th>RecentDelays</th>\n",
       "      <th>Airline</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>LoNDon_paris</td>\n",
       "      <td>10045.0</td>\n",
       "      <td>[23, 47]</td>\n",
       "      <td>KLM(!)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>MAdrid_miLAN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[]</td>\n",
       "      <td>&lt;Air France&gt; (12)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>londON_StockhOlm</td>\n",
       "      <td>10065.0</td>\n",
       "      <td>[24, 43, 87]</td>\n",
       "      <td>(British Airways. )</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Budapest_PaRis</td>\n",
       "      <td>NaN</td>\n",
       "      <td>[13]</td>\n",
       "      <td>12. Air France</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Brussels_londOn</td>\n",
       "      <td>10085.0</td>\n",
       "      <td>[67, 32]</td>\n",
       "      <td>\"Swiss Air\"</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            From_To  FlightNumber  RecentDelays              Airline\n",
       "0      LoNDon_paris       10045.0      [23, 47]               KLM(!)\n",
       "1      MAdrid_miLAN           NaN            []    <Air France> (12)\n",
       "2  londON_StockhOlm       10065.0  [24, 43, 87]  (British Airways. )\n",
       "3    Budapest_PaRis           NaN          [13]       12. Air France\n",
       "4   Brussels_londOn       10085.0      [67, 32]          \"Swiss Air\""
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df = pd.DataFrame({'From_To': ['LoNDon_paris', 'MAdrid_miLAN', 'londON_StockhOlm', \n",
    "                               'Budapest_PaRis', 'Brussels_londOn'],\n",
    "              'FlightNumber': [10045, np.nan, 10065, np.nan, 10085],\n",
    "              'RecentDelays': [[23, 47], [], [24, 43, 87], [13], [67, 32]],\n",
    "                   'Airline': ['KLM(!)', '<Air France> (12)', '(British Airways. )', \n",
    "                               '12. Air France', '\"Swiss Air\"']})\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "A5514B83AF294CEA9A91F4EBD70829CF",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "37.`FlightNumber`列中有些值缺失了，他们本来应该是每一行增加10，填充缺失的数值，并且令数据类型为整数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false,
    "id": "C966348861274DED830F3D0A78E72273",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>From_To</th>\n",
       "      <th>FlightNumber</th>\n",
       "      <th>RecentDelays</th>\n",
       "      <th>Airline</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>LoNDon_paris</td>\n",
       "      <td>10045</td>\n",
       "      <td>[23, 47]</td>\n",
       "      <td>KLM(!)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>MAdrid_miLAN</td>\n",
       "      <td>10055</td>\n",
       "      <td>[]</td>\n",
       "      <td>&lt;Air France&gt; (12)</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>londON_StockhOlm</td>\n",
       "      <td>10065</td>\n",
       "      <td>[24, 43, 87]</td>\n",
       "      <td>(British Airways. )</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Budapest_PaRis</td>\n",
       "      <td>10075</td>\n",
       "      <td>[13]</td>\n",
       "      <td>12. Air France</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Brussels_londOn</td>\n",
       "      <td>10085</td>\n",
       "      <td>[67, 32]</td>\n",
       "      <td>\"Swiss Air\"</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            From_To  FlightNumber  RecentDelays              Airline\n",
       "0      LoNDon_paris         10045      [23, 47]               KLM(!)\n",
       "1      MAdrid_miLAN         10055            []    <Air France> (12)\n",
       "2  londON_StockhOlm         10065  [24, 43, 87]  (British Airways. )\n",
       "3    Budapest_PaRis         10075          [13]       12. Air France\n",
       "4   Brussels_londOn         10085      [67, 32]          \"Swiss Air\""
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['FlightNumber'] = df['FlightNumber'].interpolate().astype(int)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "DF2998C5B9FB4C838CC6B9E8C3D69739",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "38.将`From_To`列从`_`分开，分成`From, To`两列，并删除原始列"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false,
    "id": "9C6E47AB6E4746ABAFF4A5AE4BB15C5B",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>FlightNumber</th>\n",
       "      <th>RecentDelays</th>\n",
       "      <th>Airline</th>\n",
       "      <th>From</th>\n",
       "      <th>To</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10045</td>\n",
       "      <td>[23, 47]</td>\n",
       "      <td>KLM(!)</td>\n",
       "      <td>LoNDon</td>\n",
       "      <td>paris</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>10055</td>\n",
       "      <td>[]</td>\n",
       "      <td>&lt;Air France&gt; (12)</td>\n",
       "      <td>MAdrid</td>\n",
       "      <td>miLAN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10065</td>\n",
       "      <td>[24, 43, 87]</td>\n",
       "      <td>(British Airways. )</td>\n",
       "      <td>londON</td>\n",
       "      <td>StockhOlm</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10075</td>\n",
       "      <td>[13]</td>\n",
       "      <td>12. Air France</td>\n",
       "      <td>Budapest</td>\n",
       "      <td>PaRis</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10085</td>\n",
       "      <td>[67, 32]</td>\n",
       "      <td>\"Swiss Air\"</td>\n",
       "      <td>Brussels</td>\n",
       "      <td>londOn</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   FlightNumber  RecentDelays              Airline      From         To\n",
       "0         10045      [23, 47]               KLM(!)    LoNDon      paris\n",
       "1         10055            []    <Air France> (12)    MAdrid      miLAN\n",
       "2         10065  [24, 43, 87]  (British Airways. )    londON  StockhOlm\n",
       "3         10075          [13]       12. Air France  Budapest      PaRis\n",
       "4         10085      [67, 32]          \"Swiss Air\"  Brussels     londOn"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "temp = df.From_To.str.split('_', expand=True)\n",
    "temp.columns = ['From', 'To']\n",
    "df = df.join(temp)\n",
    "df = df.drop('From_To', axis=1)\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "6158CB82BEFF471186E695AFCF141578",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "39.将`From, To`大小写统一"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": false,
    "id": "723B7E56837A4D1AB35FB629F4EA27F7",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>FlightNumber</th>\n",
       "      <th>RecentDelays</th>\n",
       "      <th>Airline</th>\n",
       "      <th>From</th>\n",
       "      <th>To</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10045</td>\n",
       "      <td>[23, 47]</td>\n",
       "      <td>KLM(!)</td>\n",
       "      <td>London</td>\n",
       "      <td>Paris</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>10055</td>\n",
       "      <td>[]</td>\n",
       "      <td>&lt;Air France&gt; (12)</td>\n",
       "      <td>Madrid</td>\n",
       "      <td>Milan</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10065</td>\n",
       "      <td>[24, 43, 87]</td>\n",
       "      <td>(British Airways. )</td>\n",
       "      <td>London</td>\n",
       "      <td>Stockholm</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10075</td>\n",
       "      <td>[13]</td>\n",
       "      <td>12. Air France</td>\n",
       "      <td>Budapest</td>\n",
       "      <td>Paris</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10085</td>\n",
       "      <td>[67, 32]</td>\n",
       "      <td>\"Swiss Air\"</td>\n",
       "      <td>Brussels</td>\n",
       "      <td>London</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   FlightNumber  RecentDelays              Airline      From         To\n",
       "0         10045      [23, 47]               KLM(!)    London      Paris\n",
       "1         10055            []    <Air France> (12)    Madrid      Milan\n",
       "2         10065  [24, 43, 87]  (British Airways. )    London  Stockholm\n",
       "3         10075          [13]       12. Air France  Budapest      Paris\n",
       "4         10085      [67, 32]          \"Swiss Air\"  Brussels     London"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['From'] = df['From'].str.capitalize()\n",
    "df['To'] = df['To'].str.capitalize()\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "4E3A3DA70FC34F01ACA10F535844B079",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "40.`Airline`列，有一些多余的标点符号，需要提取出正确的航司名称。举例：`'(British Airways. )'` 应该改为 `'British Airways'`."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": false,
    "id": "9F9F0D09D80F4B8E837F4ABB09DBC76C",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>FlightNumber</th>\n",
       "      <th>RecentDelays</th>\n",
       "      <th>Airline</th>\n",
       "      <th>From</th>\n",
       "      <th>To</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10045</td>\n",
       "      <td>[23, 47]</td>\n",
       "      <td>KLM</td>\n",
       "      <td>London</td>\n",
       "      <td>Paris</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>10055</td>\n",
       "      <td>[]</td>\n",
       "      <td>Air France</td>\n",
       "      <td>Madrid</td>\n",
       "      <td>Milan</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10065</td>\n",
       "      <td>[24, 43, 87]</td>\n",
       "      <td>British Airways</td>\n",
       "      <td>London</td>\n",
       "      <td>Stockholm</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10075</td>\n",
       "      <td>[13]</td>\n",
       "      <td>Air France</td>\n",
       "      <td>Budapest</td>\n",
       "      <td>Paris</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10085</td>\n",
       "      <td>[67, 32]</td>\n",
       "      <td>Swiss Air</td>\n",
       "      <td>Brussels</td>\n",
       "      <td>London</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   FlightNumber  RecentDelays          Airline      From         To\n",
       "0         10045      [23, 47]              KLM    London      Paris\n",
       "1         10055            []       Air France    Madrid      Milan\n",
       "2         10065  [24, 43, 87]  British Airways    London  Stockholm\n",
       "3         10075          [13]       Air France  Budapest      Paris\n",
       "4         10085      [67, 32]        Swiss Air  Brussels     London"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['Airline'] = df['Airline'].str.extract('([a-zA-Z\\s]+)', expand=False).str.strip()\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "2433A20C6E6D47E381B6EB1B738F8577",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "41.`Airline`列，数据被以列表的形式录入，但是我们希望每个数字被录入成单独一列，`delay_1, delay_2, ...`没有的用NAN替代。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false,
    "id": "F779D702D1BD4C4082DBDF2D31BA7D57",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-47-507648599e55>:1: FutureWarning: The default dtype for empty Series will be 'object' instead of 'float64' in a future version. Specify a dtype explicitly to silence this warning.\n",
      "  delays = df['RecentDelays'].apply(pd.Series)\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>FlightNumber</th>\n",
       "      <th>Airline</th>\n",
       "      <th>From</th>\n",
       "      <th>To</th>\n",
       "      <th>delay_1</th>\n",
       "      <th>delay_2</th>\n",
       "      <th>delay_3</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>10045</td>\n",
       "      <td>KLM</td>\n",
       "      <td>London</td>\n",
       "      <td>Paris</td>\n",
       "      <td>23.0</td>\n",
       "      <td>47.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>10055</td>\n",
       "      <td>Air France</td>\n",
       "      <td>Madrid</td>\n",
       "      <td>Milan</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>10065</td>\n",
       "      <td>British Airways</td>\n",
       "      <td>London</td>\n",
       "      <td>Stockholm</td>\n",
       "      <td>24.0</td>\n",
       "      <td>43.0</td>\n",
       "      <td>87.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>10075</td>\n",
       "      <td>Air France</td>\n",
       "      <td>Budapest</td>\n",
       "      <td>Paris</td>\n",
       "      <td>13.0</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>10085</td>\n",
       "      <td>Swiss Air</td>\n",
       "      <td>Brussels</td>\n",
       "      <td>London</td>\n",
       "      <td>67.0</td>\n",
       "      <td>32.0</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   FlightNumber          Airline      From         To  delay_1  delay_2  \\\n",
       "0         10045              KLM    London      Paris     23.0     47.0   \n",
       "1         10055       Air France    Madrid      Milan      NaN      NaN   \n",
       "2         10065  British Airways    London  Stockholm     24.0     43.0   \n",
       "3         10075       Air France  Budapest      Paris     13.0      NaN   \n",
       "4         10085        Swiss Air  Brussels     London     67.0     32.0   \n",
       "\n",
       "   delay_3  \n",
       "0      NaN  \n",
       "1      NaN  \n",
       "2     87.0  \n",
       "3      NaN  \n",
       "4      NaN  "
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "delays = df['RecentDelays'].apply(pd.Series)\n",
    "delays.columns = ['delay_{}'.format(n) for n in range(1, len(delays.columns)+1)]\n",
    "df = df.drop('RecentDelays', axis=1).join(delays)\n",
    "\n",
    "df"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "EBEC4771C87D4E94837A07FBC3D2FB86",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "## 层次化索引"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "365219BB0A2142F789CD512EC8DD8DA0",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "42.用 `letters = ['A', 'B', 'C']` 和 `numbers = list(range(10))`的组合作为系列随机值的层次化索引"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false,
    "id": "3941AB87138449D4839163AAA610B79B",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "A  0    0.778192\n",
       "   1    0.278750\n",
       "   2    0.768724\n",
       "   3    0.530933\n",
       "B  0    0.398912\n",
       "   1    0.516323\n",
       "   2    0.901985\n",
       "   3    0.147985\n",
       "C  0    0.346292\n",
       "   1    0.218281\n",
       "   2    0.639534\n",
       "   3    0.626857\n",
       "dtype: float64"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "letters = ['A', 'B', 'C']\n",
    "numbers = list(range(4))\n",
    "\n",
    "mi = pd.MultiIndex.from_product([letters, numbers])\n",
    "s = pd.Series(np.random.rand(12), index=mi)\n",
    "s"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "1C32A5A6E21B46438E6C74362326396E",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "43.检查`s`是否是字典顺序排序的"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "collapsed": false,
    "id": "A5E45FD54216448494C431702C75F220",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [],
   "source": [
    "# TODO 判别字典排序方法弃用\n",
    "# 方法一(高版本弃用)\n",
    "# s.index.is_lexsorted()\n",
    "# 方法二\n",
    "# s.index.lexsort_depth == s.index.nlevels"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "65DB246948F54D33AD898EE03C6F4194",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "44.选择二级索引为`1, 3`的行"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false,
    "id": "DA5943E1C5774D999FA32D3DDA7C7BAD",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "A  1    0.278750\n",
       "   3    0.530933\n",
       "B  1    0.516323\n",
       "   3    0.147985\n",
       "C  1    0.218281\n",
       "   3    0.626857\n",
       "dtype: float64"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.loc[:, [1, 3]]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "E3B271B10E514224A23D471B5B7C5F61",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "45.对`s`进行切片操作，取一级索引从头至`B`，二级索引从`2`开始到最后"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "collapsed": false,
    "id": "6B626EA066FA41098A837850832D0F66",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "A  2    0.768724\n",
       "   3    0.530933\n",
       "B  2    0.901985\n",
       "   3    0.147985\n",
       "dtype: float64"
      ]
     },
     "execution_count": 51,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.loc[pd.IndexSlice[:'B', 2:]]\n",
    "# 方法二\n",
    "# s.loc[slice(None, 'B'), slice(2, None)]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "63258D8A886649D899C95A837D72349C",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "46.计算每个一级索引的和（A, B, C每一个的和）"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "collapsed": false,
    "id": "4942734127674CE39FBFE078DA51DF74",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "A    2.356599\n",
       "B    1.965205\n",
       "C    1.830963\n",
       "dtype: float64"
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "s.groupby(level=0).sum()\n",
    "#方法二\n",
    "#s.unstack().sum(axis=0)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "3EAA26B0B98D4A078B457986919EC070",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "47.交换索引等级，新的Series是字典顺序吗？不是的话请排序"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "collapsed": false,
    "id": "BA78AE9AB69240AC8B3C9E143C41A5DC",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0  A    0.778192\n",
      "1  A    0.278750\n",
      "2  A    0.768724\n",
      "3  A    0.530933\n",
      "0  B    0.398912\n",
      "1  B    0.516323\n",
      "2  B    0.901985\n",
      "3  B    0.147985\n",
      "0  C    0.346292\n",
      "1  C    0.218281\n",
      "2  C    0.639534\n",
      "3  C    0.626857\n",
      "dtype: float64\n",
      "False\n",
      "0  A    0.778192\n",
      "   B    0.398912\n",
      "   C    0.346292\n",
      "1  A    0.278750\n",
      "   B    0.516323\n",
      "   C    0.218281\n",
      "2  A    0.768724\n",
      "   B    0.901985\n",
      "   C    0.639534\n",
      "3  A    0.530933\n",
      "   B    0.147985\n",
      "   C    0.626857\n",
      "dtype: float64\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "<ipython-input-53-9bc1d251a0b8>:3: FutureWarning: MultiIndex.is_lexsorted is deprecated as a public function, users should use MultiIndex.is_monotonic_increasing instead.\n",
      "  print(new_s.index.is_lexsorted())   # TODO 判别首字母排序\n"
     ]
    }
   ],
   "source": [
    "new_s = s.swaplevel(0, 1)\n",
    "print(new_s)\n",
    "print(new_s.index.is_lexsorted())   # TODO 判别首字母排序\n",
    "new_s = new_s.sort_index()\n",
    "print(new_s)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "5947FCF045F643D58DCF2330FEFFECE2",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "## 可视化"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 54,
   "metadata": {
    "collapsed": false,
    "id": "E257843110B542A08DD732237CEB62EF",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "df = pd.DataFrame({\"xs\":[1,5,2,8,1], \"ys\":[4,2,1,9,6]})\n",
    "plt.style.use('ggplot')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "ABA878EB9825499883EAB997A8B0F10A",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "48.画出`df`的散点图"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "collapsed": false,
    "id": "EE673BF23AAA4CAE8506223454716FAA",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='xs', ylabel='ys'>"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEJCAYAAAB11IfBAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAAYRElEQVR4nO3da2xT9/3H8c9JjDEXBYcExByuYUErPABRsaSiVBPYa9V0m6ahaFRdlYJVSkCIbmIwJi0elGIKHoiNCjZrTHuyy4OpE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ysjJdvXo1z6kezLKszv1y29vb1d7ePqi3T7xy5YpOnDihRYsW5TvKkHPr1i199NFHnftReDwejRo1Ks+pHq6xsVETJkzQuHHj8h2lWx0dHcpms2pvb1c2m+3XfS6G1DKOW7W0tOjcuXP68pe/nO8oXero6NC6det0+fJlPf3006qoqMh3pC795je/0QsvvKDbt2/nO0qPbd68WZIUCoUG9WOCLS0tKioq0ptvvqkLFy6ovLxctbW1nTcDg9U777yj+fPn5ztGt8aOHatvfOMbWrFihbxer2bPnq3Zs2f32/WH1J29G2UyGcViMdXW1mrkyJH5jtOlgoICbdu2TXv27NHZs2d18eLFfEd6oOPHj2vMmDGdf2tyg02bNmnr1q3asGGDDh06pA8//DDfkbrU3t6uc+fO6etf/7reeOMNDR8+XG+99Va+Y3Url8vp+PHjqqqqyneUbt24cUPvvfeedu/erb179yqTyejIkSP9dn3KPo9yuZxisZgWLFigysrKfMfpkVGjRmnmzJl6//338x3lgZqamnTs2DGtXLlSO3fu1AcffKBdu3blO1a3xo4dK0kaM2aM5s2bpzNnzuQ5UddKSkpUUlLS+Te7qqoqnTt3Ls+punfy5ElNmzZNfr8/31G61djYqPHjx6uoqEgej0eVlZX6+OOP++36LOPkiW3b2rNnj8rKyvTcc8/lO063rl+/rsLCQo0aNUrZbFaNjY361re+le9YD/T888/r+eeflySdPn1a+/fv1+rVq/OcqmuZTEa2bWvEiBHKZDI6deqUFi9enO9YXfL7/SopKVFzc7MCgYAaGxs1ceLEfMfqlhuWcCSptLRUn3zyidra2uT1etXY2Kjp06f32/WHVNm7aWPzpqYmHTlyRJMnT9batWslSUuWLNHcuXPznOx+qVRKu3fvVkdHh2zb1hNPPKHHH38837GGhGvXrmn79u2SvlgiefLJJzVnzpz8hnqIpUuXateuXcrlcho/frzq6uryHalLbW1tOnXqlF5++eV8R3moiooKVVVVad26dSosLNTUqVP79d9v+LoEADAAa/YAYADKHgAMQNkDgAEoewAwAGUPAAag7AHAAJQ9ABiAsgcAA1D2QBcuX76sl156Sf/6178kSVevXtWyZct0+vRp/fWvf9WqVav04osvauXKlTp69Gie0wLd4xO0QDeSyaQaGhoUjUa1fft2TZo0STU1NVq+fLm2bNmiQCCgVCqlGzduaNKkSfmOC3SJO3ugG8FgUBMmTNCGDRuUSqW0ZMkSSV9s6HLx4sXODSYoegx2lD3wEIsWLdKlS5f0zDPPaNiwYfL5fFqzZo0SiYRefvllbdmyRZ999lm+YwLdYhkH6EYmk9HatWs1a9YsnTx5UrFY7J6tL7PZrH7/+9/rzJkz2rhxYx6TAt3jzh7oxr59+zRt2jS98sormjt3rn75y18qnU7r2LFjymQy8ng88vl8KijgfyUMbtzZA1147733FI/HO+/m79zl19TUKJlM6vz587IsS1OnTlU4HB70m3jAbJQ9ABiAv3sCgAEoewAwAGUPAAag7AHAAJQ9ABiAsgcAA1D2AGAAyh4ADPB/i63P8r+r34sAAAAASUVORK5CYII=",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df.plot.scatter(\"xs\", \"ys\", color = \"black\", marker = \"x\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "3571FCD0673346158D19B701FF540CD4",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "49.可视化指定4维DataFrame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {
    "collapsed": false,
    "id": "763CECD47B954A6F804898FBAFFE9BC2",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<AxesSubplot:xlabel='hours_in', ylabel='productivity'>"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXsAAAEJCAYAAAB11IfBAAAAOXRFWH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oW7774bb731Fvr164dNmzYpPgeRHCz21CtNmzYNNpsNZrMZt9xyC6qrq7Fz505MnDgRhYWF0Gg0uO+++3D8+HHU1tbKOqfVasW0adOgVquh1WohiiIuXryIhoYGaLVaDBs2THHOUaNGYciQIVCr1Rg3bhyqq6sVn4NIDhZ76pWunDtdq9XC6/WioaEBdrs98nO9Xg+z2Sx7mcgrjwWA2bNnQ5IkPP3001iyZAm2bt0aU06dTgev16v4HERysM+eMobVakVdXV3ke6/XC7fbDZvNFlnCz+fzRVYSc7lcXZ7PYrHgkUceAQD87W9/w3PPPYfi4mL2uVNa4pU9ZYxx48Zh27ZtqK6uRiAQwMaNGzFkyJDIqkU2mw07d+5EOBzG1q1bux0Pv3v3bjidTgCILPAdz2XkiOKJV/aUMW688Ubcc889qKiogNvtxnXXXYfHHnsssn3+/Pl44403sHHjRkyaNAlDhw7t8nxVVVV4++234fF4YLFY8OCDDyIvLy/B/wqi6HDxEiKiDMDPnEREGYDdOERxdPToUSxfvrzDbZwqgVKJ3ThERBmA3ThERBmAxZ6IKAOw2BMRZQAWeyKiDPD/AKMtelY2HCvNAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df = pd.DataFrame({\"productivity\":[5,2,3,1,4,5,6,7,8,3,4,8,9],\n",
    "                   \"hours_in\"    :[1,9,6,5,3,9,2,9,1,7,4,2,2],\n",
    "                   \"happiness\"   :[2,1,3,2,3,1,2,3,1,2,2,1,3],\n",
    "                   \"caffienated\" :[0,0,1,1,0,0,0,0,1,1,0,1,0]})\n",
    "\n",
    "df.plot.scatter(\"hours_in\", \"productivity\", s = df.happiness * 100, c = df.caffienated)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "id": "3A18A9AE34D8418A863948333844BB7D",
    "jupyter": {},
    "mdEditEnable": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "source": [
    "50.在同一个图中可视化2组数据，共用X轴，但y轴不同"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "collapsed": false,
    "id": "9089C025DDC44A74836D5A1ADB6AD5EC",
    "jupyter": {},
    "scrolled": false,
    "slideshow": {
     "slide_type": "slide"
    },
    "tags": [],
    "trusted": true
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEJCAYAAAB/pOvWAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuMiwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8vihELAAAACXBIWXMAAAsTAAALEwEAmpwYAAA4tUlEQVR4nO3deUBU5foH8O+ZgWEThmFGXBBUXFISd8L0KqYjkuFSmWVlqanX1AztciUtrcwylTAML91ySX+3cqko08pQw0pNFExDAzFUBJFlhn2dOe/vj2lGiB1m5gwzz+cvhTPv+wwoX57znvccjjHGQAghhNQiEroAQgghlofCgRBCSD0UDoQQQuqhcCCEEFIPhQMhhJB6KBwIIYTUY2fuCbOzs809JSGEdGjdu3c3+5zUORBCCKmHwoEQQkg9FA6EEELqMfuaAyGkeYwxVFZWgud5cBwndDnEDBhjEIlEcHR0tIjvOYUDIRaosrIS9vb2sLOj/6K2RKPRoLKyEk5OTkKXQqeVCLFEPM9TMNggOzs78DwvdBkAKBwIsUiWcFqBCMNSvvcUDsRs2LmfwdQFQpdBCGkB6luJWbDUS+A/2AT06AXRy5vBSRyELqlD8frQy6jjZS3MMup4xPpQOBCz4L/+FHByAW5dB9v3Ebg5S9s9Zlt+YNIPxbZhjBmupiG2gb7TxORY6iUg7Xdw058E9+CjYCe/B/9rgtBlkWZkZmYiKCgIL7/8MiZPnoytW7diypQpUCqV2LJlCwBgw4YN2L17t+E1kZGRiI2NBQD85z//qXe8fszw8HA88MADmD17NioqKgAAM2fOxG+//QYAUKlUCAwMBABotVqsX7/eMNbevXvN9SWwaRQOxOT4rz8Fp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5uhkoJsQxW8yQ4QprSvXt3vPDCC9i5c6fhaqVVq1bBzq75/wJeXl4YM2YMli1bBp7n8e6775qhYkKERZeyEkIIqYdOKxFCCKmHwoEQQkg9FA6EEELqoXAghBBSD4UDIYSQeigcCCGE1EPhQAghpB4KB0IIIfX8P+gwEJ/5Vr7rAAAAAElFTkSuQmCC",
      "text/plain": [
       "<Figure size 432x288 with 2 Axes>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "df = pd.DataFrame({\"revenue\":[57,68,63,71,72,90,80,62,59,51,47,52],\n",
    "                   \"advertising\":[2.1,1.9,2.7,3.0,3.6,3.2,2.7,2.4,1.8,1.6,1.3,1.9],\n",
    "                   \"month\":range(12)})\n",
    "\n",
    "ax = df.plot.bar(\"month\", \"revenue\", color = \"green\")\n",
    "df.plot.line(\"month\", \"advertising\", secondary_y = True, ax = ax)\n",
    "ax.set_xlim((-1,12));"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python-data-analysis",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.19"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
